(usually used with right/well or wrong/ill) To perform on behalf of someone or with someone in mind; to behave in a manner befitting someone.
Do as you would be done by.